<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>课工场论坛列表</title>
    <link href="css/bbs.css" rel="stylesheet">
    <script type="text/javascript">
    
    var title;
    var sp;
    	function fatie(){
    	var ppost=document.getElementById("post").style.display="block";
        document.getElementById("bankuai").value=null;
        document.getElementById("title").value=null;
        document.getElementById("textarea").value=null;  	
    	}
    	function fabu(){
    		var ppost=document.getElementById("post").style.display="none";
    	var tou=new Array("tou01.jpg","tou02.jpg","tou03.jpg","tou04.jpg");
    	var newnode1=document.createElement("li");
    	var num=Math.floor(Math.random()*4+1);
        var img=document.createElement("img");
        var div=document.createElement("div");
        img.setAttribute("src","images/tou0"+num+".jpg");
        img.setAttribute("style","border-radius: 50%;");
        var titleH1=document.createElement("h1");
        title=document.getElementById("title").value;
        titleH1.innerHTML=title;	
        var span1=document.createElement("p");
        sp=document.getElementById("bankuai").value;     
        span1.innerHTML="板块:"+sp;
       
        
        //发表时间
        var span2=document.createElement("p");
        var today=new Date();
        var year=today.getFullYear();
        var month=today.getMonth();
        var day=today.getDate();
        var hh=today.getHours();
        var mm=today.getMinutes();
        span2.innerHTML="发表时间:"+year+"-"+month+"-"+day+" "+hh+":"+mm;
        div.appendChild(img);
        newnode1.appendChild(div);
        newnode1.appendChild(titleH1);
        newnode1.appendChild(span1);
        newnode1.appendChild(span2);
        
        var uul=document.getElementById("ul");
        uul.appendChild(newnode1);
        
 
    	}
    </script>	
</head>
<body>
<div class="bbs">
    <header><span onclick="fatie();">我要发帖</span></header>
    <section>
        <ul id="ul">
        	
        </ul>
    </section>
    <div class="post" id="post">
        <input class="title" placeholder="请输入标题（1-50个字符）" id="title">
        所属版块：<select id="bankuai"><option>请选择版块</option><option>电子书籍</option><option>新课来了</option><option>新手报到</option><option>职业规划</option></select>
        <textarea class="content" id="textarea"></textarea>
        <input class="btn" value="发布" onclick="fabu();">
    </div>
</div>
</body>
</html>